import promotionApi from '@/api/declaration/mall/promotionApi'
import httpRequest from '@/config/axios/httpRequest'
import { ArticleCategoryModel } from '@/models/mall/ArticleCategoryModel'

// 查询文章分类列表
export const getArticleCategoryPage = async (params) => {
  return await httpRequest.get(promotionApi.GetArticleCategoryPage, params)
}

// 查询文章分类精简信息列表
export const getSimpleArticleCategoryList = async () => {
  return await httpRequest.get(promotionApi.GetSimpleArticleCategoryList)
}

// 查询文章分类详情
export const getArticleCategory = async (id: number) => {
  return await httpRequest.get(promotionApi.GetArticleCategory, { params: { id } })
}

// 新增文章分类
export const createArticleCategory = async (data: ArticleCategoryModel) => {
  return await httpRequest.post(promotionApi.CreateArticleCategory, data)
}

// 修改文章分类
export const updateArticleCategory = async (data: ArticleCategoryModel) => {
  return await httpRequest.put(promotionApi.UpdateArticleCategory, data)
}

// 删除文章分类
export const deleteArticleCategory = async (id: number) => {
  return await httpRequest.delete(promotionApi.DeleteArticleCategory, { params: { id } })
}
